package com.kx.springboot;

import com.kx.springboot.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Springboot027Java2Application implements CommandLineRunner {
    @Autowired
    private StudentService studentService;

    //SpringBoot启动程序，初始化Spring容器
    public static void main(String[] args) {
        SpringApplication.run(Springboot027Java2Application.class, args);
    }
    //重写CommandLineRunner类中的run方法，并调用业务方法
    @Override
    public void run(String... args) throws Exception {
        String str = studentService.sayHello("world");
        System.out.println(str);
    }

}
